home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Developers / Drill Designer 1.1 / Demo Programs / Recycle C Folder / Drill Designer.h next >
Encoding:
C/C++ Source or Header  |  1995-01-23  |  5.4 KB  |  139 lines  |  [TEXT/KAHL]

  1. #include <ctype.h>                /* Character class tests: isdigit, toupper, */
  2. #include <stdarg.h>                /* Variable length argument lists. */                
  3. #include <string.h>                /* String functions: strcat, strcpy, */
  4. #include <stdlib.h>                /* rand, RAND_MAX */
  5. #include <time.h>                /* Time utilities */
  6. #include <stdio.h>                /* File storage & retrieval */
  7.  
  8. typedef struct i_node *item_ptr;             
  9.  
  10. typedef struct i_node    
  11.         {    item_ptr             prev;
  12.             short                question_Num;
  13.             short                times_Missed;
  14.             short                times_Answered;
  15.             item_ptr            next;        
  16.         }                                                item_node;
  17.  
  18. #define                value                question_Num
  19. #define                MAX_SIZE            32766
  20. #define                AT_END                32767    
  21. #define                NO_ERROR              '\0'
  22. #define              MAX_ERROR_LENGTH     256
  23. #define                MAX_FILENAME_LENGTH    32
  24. #define                SET_TIME            1
  25. #define                DONT_SET            0
  26. #define                MEM_ERROR            "Ran out of memory\n"
  27. #define                INVALID_TARG_CHAR   "Invalid target list char, default set\n"
  28. #define                NO_INS_LIST            "No insert positions list, can't execute\n"
  29. #define                ITEM_TOO_LARGE        "Item larger than question pool size\n"
  30.  
  31.  
  32.  
  33. enum insert_Techniques
  34.     {    DII = 0,
  35.         RDII,
  36.         RDIns,
  37.         RDInt,
  38.         RFII,
  39.         EC
  40.     };
  41.  
  42.  
  43. typedef struct global_space        
  44.         {    short        insert_technique_Code;
  45.             char        orientation_Char;
  46.             short        smallest_Position;
  47.             short        fewest_Insertions;
  48.             short        num_to_Retire;
  49.             short        num_Retired;
  50.             short        max_item_Num;
  51.             item_ptr    incorrect_Head;
  52.             item_ptr    incorrect_Tail;
  53.             item_ptr    replenish_Head;
  54.             item_ptr    replenish_Tail;
  55.             item_ptr    future_queue_Head;
  56.             item_ptr    future_queue_Tail;
  57.             item_ptr    long_list_Head;
  58.             item_ptr    long_list_Tail;
  59.             item_ptr    retired_items_Head;
  60.             item_ptr    retired_items_Tail;
  61.             item_ptr    hard_list_Head;
  62.             item_ptr    hard_list_Tail;
  63.             item_ptr    resurrect_Ptr;
  64.             time_t        start_Time;
  65.             long        time_spent_Current;
  66.             long        time_spent_Previous;
  67.             short          questions_answered_Current;
  68.             short        questions_answered_Previous;
  69.             short        questions_correct_Current;
  70.             short        questions_correct_Previous;
  71.             char          error_Message [MAX_ERROR_LENGTH];
  72.  
  73.         }                                                    global_struct;
  74.  
  75. typedef struct global_space *global_ptr;
  76.  
  77. /* Declare toolbox routines used */
  78.  
  79.     extern pascal Ptr NewPtr (long);
  80. /*    extern pascal void DisposPtr (void *); */
  81.  
  82. /* Prototypes for primary functions (in order of appearance) */
  83.     void         CreateDrill (global_ptr *ds_Handle, short num_of_Questions, short num_of_Repeats, 
  84.                              short question_pool_Size, char orientation_Char, 
  85.                              char *insert_Technique, char *incorrect_Positions, ...);
  86.     void        Store (global_ptr ds, char *student_ID, char *drill_ID, 
  87.                        char *author_Variables);
  88.     char *        Restore (global_ptr *ds_Handle, char *student_ID, char *drill_ID);
  89.     short        Next (global_ptr ds);    
  90.     void         Correct (global_ptr ds);
  91.     void        Incorrect (global_ptr ds);
  92.     void        Requeue (global_ptr ds, short item_Num, char *requeue_Positions, 
  93.                          char target_list_Char);
  94.     void        Purge (global_ptr ds, char *item_or_Pos, char target_list_Char);
  95.     void        Retire (global_ptr ds, short item_Num);
  96.     void        Insert (global_ptr ds, short item_Num, char *insert_Positions, 
  97.                         char target_list_Char);
  98.     void        Pad (global_ptr ds, char *pad_Str, char target_list_Char);
  99.  
  100.     long        RetrieveInfo (global_ptr ds, short info_Request, ...);
  101.     void         Dispose (global_ptr *ds_Handle);
  102.     char *        GetErrorMessage (global_ptr ds);
  103.  
  104. /* Prototypes for secondary functions (in order of appearance) */    
  105.     void        Add_to_FQ (global_ptr ds, short copy_Amount, char source_list_Char);
  106.     void        Build_Hard_List (global_ptr ds, short hard_list_Goal, char hard_list_Form,
  107.                                  char source_list_Char);                                
  108.     item_ptr     Check_Lists (global_ptr ds, short target_Item);
  109.     void        Copy_Node_Data (global_ptr ds, item_ptr source_Node, item_ptr target_Node);
  110.     void        Copy_List (global_ptr ds, item_ptr source_Head, 
  111.                            item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
  112.     void        Define_Filename (global_ptr ds, char *student_ID, char *drill_ID, char *file_Name);
  113.     void        Dispose_Global_Space (global_ptr *ds_Handle);
  114.     void         Dispose_List (global_ptr ds, item_ptr *list_head_Handle, 
  115.                                    item_ptr *list_tail_Handle);
  116.     void        Dispose_Node (global_ptr ds, item_ptr node_Ptr, 
  117.                                    item_ptr *list_head_Handle, item_ptr *list_tail_Handle);                                
  118.     short        Encode_Insert_Technique (global_ptr ds, char *technique_Str);
  119.     item_ptr    First_Occurrence (global_ptr ds, short item_num, item_ptr list_Ptr);                            
  120.     short        Get_List_Length (global_ptr ds, item_ptr list_Ptr);
  121.     item_ptr    Get_Nth (global_ptr ds, short ds_N, item_ptr list_Ptr);
  122.     void         Get_Time (global_ptr ds, short ds_Set);
  123.     short        Greater_Than_Previous (global_ptr ds, item_ptr test_Node);
  124.     void         Insert_List (global_ptr ds, item_ptr ins_Node, item_ptr positions_Ptr,
  125.                              item_ptr *target_head_Handle, item_ptr *target_tail_Handle);
  126.     void        Insert_Node (global_ptr ds, item_ptr ins_Node, short ins_Pos, 
  127.                              item_ptr *list_head_Handle, item_ptr *list_tail_Handle);
  128.     void        Make_Global_Space (global_ptr *ds_Handle);
  129.     item_ptr    Make_Node (global_ptr ds);
  130.     short        Num_Occurrences (global_ptr ds, short item_Num, item_ptr list_Head);
  131.     void        Replenish (global_ptr ds);
  132.     void        Scramble_List (global_ptr ds, short group_Size, item_ptr list_Head);    
  133.     void        Set_Lists (global_ptr ds, char *target_list_char_Ptr, 
  134.                            item_ptr **list_head_handle_Ptr, item_ptr **list_tail_handle_Ptr);    
  135.     short        Size_Needed (global_ptr ds, item_ptr list_Ptr);
  136.     void         Str_to_Linked_List (global_ptr ds, char *source_Str, item_ptr *list_Head_Handle, 
  137.                                     item_ptr *list_Tail_Handle, char *error_Tag);
  138.     void        Update (global_ptr ds, item_ptr update_List, item_ptr update_Node);
  139.